package com.ruoyi.business.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.business.domain.DeliveryNote;
import com.ruoyi.business.domain.DeliveryNote;
import com.ruoyi.business.mapper.DeliveryNoteMapper;
import com.ruoyi.business.service.DeliveryNoteService;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author JerryLu
 * @date 2024/8/25 10:41
 * @description 发货通知单Service业务层处理
 */
@Service
public class DeliveryNoteServiceImpl extends ServiceImpl<DeliveryNoteMapper, DeliveryNote> implements DeliveryNoteService {
    @Override
    public List<DeliveryNote> queryList(DeliveryNote deliveryNote) {
        QueryWrapper<DeliveryNote> queryWrapper = Wrappers.query();
        if (StringUtils.isNotEmpty(deliveryNote.getStatus().toString())) {
            queryWrapper.eq("status", deliveryNote.getStatus());
        }
        if (deliveryNote.getBizdate() != null) {
            queryWrapper.eq("bizdate", DateUtils.dateTime(deliveryNote.getBizdate()));
        }
        if (deliveryNote.getCreateTime() != null) {
            queryWrapper.eq("create_time", DateUtils.dateTime(deliveryNote.getCreateTime()));
        }

        return this.list(queryWrapper);
    }
}
